package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.CoverFaultCheckService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by ding on 2017/8/11.
 */
@Controller
@RequestMapping("/rds_coverFaultCheck")
public class CoverFaultCheckController {
    @Resource
    private CoverFaultCheckService coverFaultCheckService;

    @RequestMapping(value = "/getCoverFault4DT")
    @ResponseBody
    public DTResponseDto getCoverFault4DT(DTRequestDto dtRequestDto, Integer actorId , Integer orgId) {
        DTResponseDto dtResponseDto = new DTResponseDto();
        try {
            dtResponseDto = coverFaultCheckService.getCoverFault4DT(dtRequestDto,actorId, orgId);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return dtResponseDto;
    }

    @RequestMapping(value = "/coverFaultAudit")
    @ResponseBody
    public JsonMsgDto coverFaultAudit(Integer isPass, String feedback, Integer coverFaultId, Integer userId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(coverFaultCheckService.coverFaultAudit(isPass, feedback, coverFaultId, userId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getCoverFaultCheckList4App")
    @ResponseBody
    public JsonMsgDto getCoverFaultCheckList4App(Integer orgId, String actorIds, Integer faultStatus, Integer count, Integer size)
            throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(coverFaultCheckService.getCoverFaultCheckList4App(orgId, actorIds, faultStatus, count, size));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }
}
